<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{text-align: center;}
    </style>
</head>
<body>
    <!-- 使用Ejs的模板引擎中的include引入公共页头代码块 -->
    <%- include('header'); -%>
    
    <h2>我的购物车</h2>
    <form action="/login" method="post">
        <table width="500" border="1" align="center">
            <tr>
                <th>id号</th>
                <th>商品名称</th>
                <th>单价</th>
                <th>数量</th>
                <th>小计</th>
                <th>操作</th>
            </tr>
            <% for(let key in cartList){ %>
                <tr>
                    <td><%= cartList[key].id %></td>
                    <td><%= cartList[key].name %></td>
                    <td><%= cartList[key].price.toFixed(2) %></td>
                    <td><%= cartList[key].m %></td>
                    <td><%= (cartList[key].m * cartList[key].price).toFixed(2) %></td>
                    <td><a href="/del?gid=<%= cartList[key].id %>">删除</a></td>
                </tr>
            <% } %>
        </table>
        </form>
</body>
</html>